<?php
    class ChannelAction extends Action{
		######################################################
		#######################大赛介绍#######################
		######################################################
		//大赛介绍--搜索
        public function introduce(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=0")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=0")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('introduce');
        }
		//大赛介绍--已发布文章
		public function introduceIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=0')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=0")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('introduceIsPublished');
		}
		//大赛介绍--未发布文章
		public function introduceNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=0')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=0")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('introduceNotPublished');
		}
		//大赛介绍--编辑
		public function introduceEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('introduceEdit');
		}
		//大赛介绍--编辑操作
		public function do_introduceEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//大赛介绍--预览
		public function introduceView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('introduceView');
		}
		//大赛介绍--删除
		public function introduceDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//大赛介绍--取消发布
		public function introducePublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//大赛介绍--添加新文章页面
		public function introduceAdd(){
			$this->display("introduceAdd");
		}
		//大赛介绍--添加新文章操作
		public function do_introduceAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		
		######################################################
		#######################赛事公告#######################
		######################################################
		
		
		
		
			//赛事公告--搜索
        public function announcement(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=1")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=1")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('announcement');
        }
		//赛事公告--已发布文章
		public function announcementIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=1')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=1")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('announcementIsPublished');
		}
		//赛事公告--未发布文章
		public function announcementNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=1')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=1")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('announcementNotPublished');
		}
		//赛事公告--编辑
		public function announcementEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('announcementEdit');
		}
		//赛事公告--编辑操作
		public function do_announcementEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//赛事公告--预览
		public function announcementView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('announcementView');
		}
		//赛事公告--删除
		public function announcementDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//赛事公告--取消发布
		public function announcementPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//赛事公告--添加新文章页面
		public function announcementAdd(){
			$this->display("announcementAdd");
		}
		//赛事公告--添加新文章操作
		public function do_announcementAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		
		
		

		######################################################
		#######################赛事动态#######################
		######################################################
		
				//大赛动态--搜索
        public function trends(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=2")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=2")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('trends');
        }
		//大赛动态--已发布文章
		public function trendsIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=2')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=2")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('trendsIsPublished');
		}
		//大赛动态--未发布文章
		public function trendsNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=2')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=2")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('trendsNotPublished');
		}
		//大赛动态--编辑
		public function trendsEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('trendsEdit');
		}
		//大赛动态--编辑操作
		public function do_trendsEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//大赛动态--预览
		public function trendsView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('trendsView');
		}
		//大赛动态--删除
		public function trendsDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//大赛动态--取消发布
		public function trendsPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//大赛动态--添加新文章页面
		public function trendsAdd(){
			$this->display("trendsAdd");
		}
		//大赛动态--添加新文章操作
		public function do_trendsAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		
		######################################################
		#######################赛事设置#######################
		######################################################
		
				//赛事设置--搜索
        public function setting(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=3")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=3")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('setting');
        }
		//赛事设置--已发布文章
		public function settingIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=3')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=3")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('settingIsPublished');
		}
		//赛事设置--未发布文章
		public function settingNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=3')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=3")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('settingNotPublished');
		}
		//赛事设置--编辑
		public function settingEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('settingEdit');
		}
		//赛事设置--编辑操作
		public function do_settingEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//赛事设置--预览
		public function settingView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('settingView');
		}
		//赛事设置--删除
		public function settingDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//赛事设置--取消发布
		public function settingPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//赛事设置--添加新文章页面
		public function settingAdd(){
			$this->display("settingAdd");
		}
		//赛事设置--添加新文章操作
		public function do_settingAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		
		
		
		
		######################################################
		#######################日程安排#######################
		######################################################
		
		//日程安排--搜索
        public function programme(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=4")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=4")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('programme');
        }
		//日程安排--已发布文章
		public function programmeIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=4')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=4")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('programmeIsPublished');
		}
		//日程安排--未发布文章
		public function programmeNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=4')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=4")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('programmeNotPublished');
		}
		//日程安排--编辑
		public function programmeEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('programmeEdit');
		}
		//日程安排--编辑操作
		public function do_programmeEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//日程安排--预览
		public function programmeView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('programmeView');
		}
		//日程安排--删除
		public function programmeDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//日程安排--取消发布
		public function programmePublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//日程安排--添加新文章页面
		public function programmeAdd(){
			$this->display("programmeAdd");
		}
		//日程安排--添加新文章操作
		public function do_programmeAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		
		######################################################
		#######################奖项设置#######################
		######################################################
				//奖项设置--搜索
        public function prize(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=5")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=5")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('prize');
        }
		//奖项设置--已发布文章
		public function prizeIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=5')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=5")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('prizeIsPublished');
		}
		//奖项设置--未发布文章
		public function prizeNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=5')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=5")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('prizeNotPublished');
		}
		//奖项设置--编辑
		public function prizeEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('prizeEdit');
		}
		//奖项设置--编辑操作
		public function do_prizeEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//奖项设置--预览
		public function prizeView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('prizeView');
		}
		//奖项设置--删除
		public function prizeDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//奖项设置--取消发布
		public function prizePublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//奖项设置--添加新文章页面
		public function prizeAdd(){
			$this->display("prizeAdd");
		}
		//奖项设置--添加新文章操作
		public function do_prizeAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		######################################################
		#######################联系我们#######################
		######################################################
				//联系我们--搜索
        public function connection(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=6")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=6")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('connection');
        }
		//联系我们--已发布文章
		public function connectionIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=6')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=6")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('connectionIsPublished');
		}
		//联系我们--未发布文章
		public function connectionNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=6')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=6")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('connectionNotPublished');
		}
		//联系我们--编辑
		public function connectionEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('connectionEdit');
		}
		//联系我们--编辑操作
		public function do_connectionEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//联系我们--预览
		public function connectionView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('connectionView');
		}
		//联系我们--删除
		public function connectionDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//联系我们--取消发布
		public function connectionPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//联系我们--添加新文章页面
		public function connectionAdd(){
			$this->display("connectionAdd");
		}
		//联系我们--添加新文章操作
		public function do_connectionAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		######################################################
		#######################精彩活动安排###################
		######################################################
				//精彩活动安排--搜索
        public function campaign(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=7")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=7")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('campaign');
        }
		//精彩活动安排--已发布文章
		public function campaignIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=7')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=7")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('campaignIsPublished');
		}
		//精彩活动安排--未发布文章
		public function campaignNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=7')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=7")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('campaignNotPublished');
		}
		//精彩活动安排--编辑
		public function campaignEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('campaignEdit');
		}
		//精彩活动安排--编辑操作
		public function do_campaignEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//精彩活动安排--预览
		public function campaignView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('campaignView');
		}
		//精彩活动安排--删除
		public function campaignDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//精彩活动安排--取消发布
		public function campaignPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//精彩活动安排--添加新文章页面
		public function campaignAdd(){
			$this->display("campaignAdd");
		}
		//精彩活动安排--添加新文章操作
		public function do_campaignAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		######################################################
		#######################大赛官方社区###################
		######################################################
				//大赛官方社区--搜索
        public function community(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=8")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=8")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('community');
        }
		//大赛官方社区--已发布文章
		public function communityIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=8')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=8")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('communityIsPublished');
		}
		//大赛官方社区--未发布文章
		public function communityNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=8')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=8")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('communityNotPublished');
		}
		//大赛官方社区--编辑
		public function communityEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('communityEdit');
		}
		//大赛官方社区--编辑操作
		public function do_communityEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//大赛官方社区--预览
		public function communityView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('communityView');
		}
		//大赛官方社区--删除
		public function communityDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//大赛官方社区--取消发布
		public function communityPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//大赛官方社区--添加新文章页面
		public function communityAdd(){
			$this->display("communityAdd");
		}
		//大赛官方社区--添加新文章操作
		public function do_communityAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		######################################################
		#######################网络商务菁英训练营#############
		######################################################
				//网络商务菁英训练营--搜索
        public function essence(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=9")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=9")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('essence');
        }
		//网络商务菁英训练营--已发布文章
		public function essenceIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=9')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=9")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('essenceIsPublished');
		}
		//网络商务菁英训练营--未发布文章
		public function essenceNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=9')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=9")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('essenceNotPublished');
		}
		//网络商务菁英训练营--编辑
		public function essenceEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('essenceEdit');
		}
		//网络商务菁英训练营--编辑操作
		public function do_essenceEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//网络商务菁英训练营--预览
		public function essenceView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('essenceView');
		}
		//网络商务菁英训练营--删除
		public function essenceDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//网络商务菁英训练营--取消发布
		public function essencePublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//网络商务菁英训练营--添加新文章页面
		public function essenceAdd(){
			$this->display("essenceAdd");
		}
		//网络商务菁英训练营--添加新文章操作
		public function do_essenceAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		######################################################
		#######################网商人才能力发展项目###########
		######################################################
				//网商人才能力发展项目--搜索
        public function develop(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=10")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=10")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('develop');
        }
		//网商人才能力发展项目--已发布文章
		public function developIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=10')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=10")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('developIsPublished');
		}
		//网商人才能力发展项目--未发布文章
		public function developNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=10')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=10")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('developNotPublished');
		}
		//网商人才能力发展项目--编辑
		public function developEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('developEdit');
		}
		//网商人才能力发展项目--编辑操作
		public function do_developEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//网商人才能力发展项目--预览
		public function developView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('developView');
		}
		//网商人才能力发展项目--删除
		public function developDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//网商人才能力发展项目--取消发布
		public function developPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//网商人才能力发展项目--添加新文章页面
		public function developAdd(){
			$this->display("developAdd");
		}
		//网商人才能力发展项目--添加新文章操作
		public function do_developAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}	
		######################################################
		#######################大赛专家顾问###################
		######################################################
				//大赛专家顾问--搜索
        public function expert(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=11")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=11")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('expert');
        }
		//大赛专家顾问--已发布文章
		public function expertIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=11')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=11")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('expertIsPublished');
		}
		//大赛专家顾问--未发布文章
		public function expertNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=11')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=11")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('expertNotPublished');
		}
		//大赛专家顾问--编辑
		public function expertEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('expertEdit');
		}
		//大赛专家顾问--编辑操作
		public function do_expertEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//大赛专家顾问--预览
		public function expertView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('expertView');
		}
		//大赛专家顾问--删除
		public function expertDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//大赛专家顾问--取消发布
		public function expertPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//大赛专家顾问--添加新文章页面
		public function expertAdd(){
			$this->display("expertAdd");
		}
		//大赛专家顾问--添加新文章操作
		public function do_expertAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		######################################################
		#######################专家寄语#######################
		######################################################
				//大赛专家顾问--搜索
        public function sendword(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=12")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=12")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('sendword');
        }
		//大赛专家顾问--已发布文章
		public function sendwordIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=12')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=12")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('sendwordIsPublished');
		}
		//大赛专家顾问--未发布文章
		public function sendwordNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=12')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=12")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('sendwordNotPublished');
		}
		//大赛专家顾问--编辑
		public function sendwordEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('sendwordEdit');
		}
		//大赛专家顾问--编辑操作
		public function do_sendwordEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//大赛专家顾问--预览
		public function sendwordView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('sendwordView');
		}
		//大赛专家顾问--删除
		public function sendwordDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//大赛专家顾问--取消发布
		public function sendwordPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//大赛专家顾问--添加新文章页面
		public function sendwordAdd(){
			$this->display("sendwordAdd");
		}
		//大赛专家顾问--添加新文章操作
		public function do_sendwordAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		######################################################
		#######################常见问题解答###################
		######################################################
		//常见问题解答--搜索
        public function question(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=13")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=13")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('question');
        }
		//常见问题解答--已发布文章
		public function questionIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=13')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=13")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('questionIsPublished');
		}
		//常见问题解答--未发布文章
		public function questionNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=13')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=13")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('questionNotPublished');
		}
		//常见问题解答--编辑
		public function questionEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('questionEdit');
		}
		//常见问题解答--编辑操作
		public function do_questionEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//常见问题解答--预览
		public function questionView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('questionView');
		}
		//常见问题解答--删除
		public function questionDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//常见问题解答--取消发布
		public function questionPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//常见问题解答--添加新文章页面
		public function questionAdd(){
			$this->display("questionAdd");
		}
		//常见问题解答--添加新文章操作
		public function do_questionAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		######################################################
		#######################媒体关注#######################
		######################################################
			//媒体关注--搜索
        public function media(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=14")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=14")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('media');
        }
		//媒体关注--已发布文章
		public function mediaIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=14')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=14")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('mediaIsPublished');
		}
		//媒体关注--未发布文章
		public function mediaNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=14')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=14")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('mediaNotPublished');
		}
		//媒体关注--编辑
		public function mediaEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('mediaEdit');
		}
		//媒体关注--编辑操作
		public function do_mediaEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//媒体关注--预览
		public function mediaView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('mediaView');
		}
		//媒体关注--删除
		public function mediaDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//媒体关注--取消发布
		public function mediaPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//媒体关注--添加新文章页面
		public function mediaAdd(){
			$this->display("mediaAdd");
		}
		//媒体关注--添加新文章操作
		public function do_mediaAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		######################################################
		#######################启动仪式#######################
		######################################################
		//启动仪式--搜索
        public function ceremony(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where." ColumnId=15")->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where." ColumnId=15")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('ceremony');
        }
		//启动仪式--已发布文章
		public function ceremonyIsPublished(){		
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 1 and ColumnId=15')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 1 and ColumnId=15")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('ceremonyIsPublished');
		}
		//启动仪式--未发布文章
		public function ceremonyNotPublished(){
			import('@.Action.Page');
			$a=$this->_post('condition');
			$b=$this->_post('name');
			$model=M();		
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a=='KeyWords'){
				$where="KeyWords like '%{$b}%' and";
			}elseif($a=='CreateDate'){
				$where="CreateDate like '%{$b}%' and";
			}elseif($a=='Title'){
				$where="Title like '%{$b}%' and";
			}elseif($a=='Author'){
				$where="Author like '%{$b}%' and";
			}
			$totalCount=$model->table('content')->where($where.'IsPublished = 0 and ColumnId=15')->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('content')->where($where."IsPublished = 0 and ColumnId=15")->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Title,Author,CreateUserName,IsPublished')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('IsPublished',$IsPublished);
			$this->assign('a',$a);
			$this->assign('b',$b);
			$this->assign('list',$rst);
            $this->display('ceremonyNotPublished');
		}
		//启动仪式--编辑
		public function ceremonyEdit(){
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('ceremonyEdit');
		}
		//启动仪式--编辑操作
		public function do_ceremonyEdit(){
			$Title=$this->_post('Title');
			$Author=$this->_post('Author');
			$CreateUserName=$this->_post('CreateUserName');
			$KeyWords=$this->_post('KeyWords');
			$id=$this->_post('id');
			$rst=M()->execute("update content set Title='{$Title}',Author='{$Author}',CreateUserName='{$CreateUserName}',KeyWords='{$KeyWords}' where id='{$id}'");
			$this->success_ajax("ok！");
		}
		//启动仪式--预览
		public function ceremonyView(){
			//echo $this->_get('id');
			$rst=M()->query("select Title,Author,CreateUserName,KeyWords from content where id={$this->_get('id')}");			
			$this->assign("id",$this->_get('id'));
			$this->assign("Title",$rst[0]['Title']);
			$this->assign("Author",$rst[0]['Author']);
			$this->assign("CreateUserName",$rst[0]['CreateUserName']);
			$this->assign("KeyWords",$rst[0]['KeyWords']);
			$this->display('ceremonyView');
		}
		//启动仪式--删除
		public function ceremonyDelete(){
			$rst=M()->execute("delete from content where id={$this->_get('id')}");
			if($rst){
				$this->success_ajax('删除成功');
			}else{
				$this->error_ajax('删除失败');
			}
		}
		//启动仪式--取消发布
		public function ceremonyPublish(){
			if($this->_get('IsPublished')==1){
				$rst=M()->execute("update content set IsPublished=0 where id={$this->_get('id')}");				
			}else{
				$rst=M()->execute("update content set IsPublished=1 where id={$this->_get('id')}");
			}
			if($rst){
				$this->success_ajax("ok！");
			}else{
				$this->error_ajax("error!");
			}
		}
		//启动仪式--添加新文章页面
		public function ceremonyAdd(){
			$this->display("ceremonyAdd");
		}
		//启动仪式--添加新文章操作
		public function do_ceremonyAdd(){
			$Title=$this->_post('Title');
			$SubjTitle=$this->_post('SubjTitle');
			$Author=$this->_post('Author');
			$KeyWords=$this->_post('KeyWords');
			$program=$this->_post('program');
			$content=$this->_post('content');
			$sql="insert into content(Title,SubjTitle,Author,KeyWords,ColumnId,content) values({$Title},{$SubjTitle},{$Author},{$KeyWords},{$program},{$content})";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok！");
				}else{
				$this->error_ajax("no!");
				}
		}
		

		
		######################################################
		#######################文件下载#######################
		######################################################
		//大赛介绍--文件搜索-----------------------------------------------------------------------搜索+分页的实现
		public function upload(){
			import('@.Action.Page');
			$model=M();			
			$a=$this->_post('name');
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a){
				$where="FileName like '%{$a}%'";
			}else{
				$where="";
			}
			$totalCount=$model->table('files')->where($where)->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('files')->where($where)->limit($pageinfo['offset'],$pageinfo['num'])->field('id,FileName,CreateDate,FileSize,TrueName')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('a',$a);
			$this->assign('list',$rst);
            $this->display();
        }
		//大赛介绍--文件上传处理
		public function do_uploadAdd(){		
			import('ORG.Net.UploadFile');
			$upload = new UploadFile();// 实例化上传类
			$upload->maxSize  = 3145728 ;// 设置附件上传大小
			//$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
			$upload->savePath =  './UpFile/PublicResource/';// 设置附件上传目录
			if(!$upload->upload()) {
			// 上传错误提示错误信息
				$this->error_ajax($upload->getErrorMsg());
			}else{
			// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			}
			$Files = M('files');
			$Files->create();
			$Files->photo=$info[0]['savename'];
			$date=date("Y-m-d H:i:s",time());
			$sql="insert into files(FileName,FilePath,CreateDate,FileSize,TrueName) values('{$this->_post('name')}','{$info[0]['savename']}','{$date}','{$info[0]['size']}','管理员')";
			$rst=M()->execute($sql);
			$this->success_ajax("ok！");
		}
		//上传文件--下载########################################
		public function uploadEdit(){
			header('Content-Type:image/gif');
			$file_dir='./UpFile/Img/Avatar/';
			$rst=M()->query("select FileName from files where id={$this->_get('id')}");
			$name=$rst[0]['FileName'];
			$filename=$file_dir.$name;
			if(!empty($name)){
				import("ORG.Net.Http");
				$download=new Http();
				$download->download($filename,$name,$name);
			}
		}
		//上传文件--删除
		public function uploadDelete(){
			$sql="delete from files where id={$this->_get('id')}";
			//echo $sql;
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok");
			}else{
				$this->error_ajax("no");
			}
		}		
		
		
		
	
		
		######################################################
		#######################E讯管理#######################
		######################################################
		//E讯管理--文件
		public function Emessage(){
			import('@.Action.Page');
			$model=M();			
			$a=$this->_post('name');
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a){
				$where="FileName like '%{$a}%'";
			}else{
				$where="";
			}
			$totalCount=$model->table('files')->where($where)->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('files')->where($where)->limit($pageinfo['offset'],$pageinfo['num'])->field('id,FileName,CreateDate,FileSize,TrueName')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('a',$a);
			$this->assign('list',$rst);
            $this->display();
        }
		
		//E讯管理--文件上传处理
		public function do_EmessageAdd(){		
			import('ORG.Net.UploadFile');
			$upload = new UploadFile();// 实例化上传类
			$upload->maxSize  = 3145728 ;// 设置附件上传大小
			//$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
			$upload->savePath =  './UpFile/PublicResource/';// 设置附件上传目录
			if(!$upload->upload()) {
			// 上传错误提示错误信息
				$this->error_ajax($upload->getErrorMsg());
			}else{
			// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			}
			$Files = M('files');
			$Files->create();
			$Files->photo=$info[0]['savename'];
			$date=date("Y-m-d H:i:s",time());
			$sql="insert into files(FileName,CreateDate,FileSize,TrueName) values('{$info[0]['savename']}','{$date}','{$info[0]['size']}','管理员')";
			$rst=M()->execute($sql);
			$this->success_ajax("ok！");
		}
		//E讯管理--下载########################################
		public function EmessageEdit(){
			header('Content-Type:image/gif');
			$file_dir='./UpFile/Img/Avatar/';
			$rst=M()->query("select FileName from files where id={$this->_get('id')}");
			$name=$rst[0]['FileName'];
			$filename=$file_dir.$name;
			if(!empty($name)){
				import("ORG.Net.Http");
				$download=new Http();
				$download->download($filename,$name,$name);
			}
		}
		//E讯管理--删除
		public function EmessageDelete(){
			$sql="delete from files where id={$this->_get('id')}";
			//echo $sql;
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok");
			}else{
				$this->error_ajax("no");
			}
		}		
	

		
		######################################################
		#######################广告管理#######################
		######################################################
		
		//广告管理--文件搜索-----------------------------------------------------------------------搜索+分页的实现
		public function ads(){
			import('@.Action.Page');
			$model=M();			
			$a=$this->_post('name');
			if($_POST['numPerPage']){
				$pagesize = $_POST['numPerPage'];
				$_GET['page'] = $_POST['pageNum'];//自定义翻页类需要 GET （当前页）信息
			}else{
				$pagesize=20;
			}
			if($a){
				$where="Name like '%{$a}%'";
			}else{
				$where="";
			}
			$totalCount=$model->table('ads')->where($where)->count();			
			$page=new Page($totalCount,$pagesize);
			$pageinfo = $page->getPageInfo();
			$rst=$model->table('ads')->where($where)->limit($pageinfo['offset'],$pageinfo['num'])->field('id,Name,Src,Url')->select();
			$this->assign('totalCount',$totalCount);
			$this->assign('currentPage',$pageinfo['page']);//分配当前页数
			$this->assign('pagesize',$pagesize);//分配一页显示的条数
			$this->assign('a',$a);
			$this->assign('list',$rst);
            $this->display();
        }
		//广告管理--文件上传处理
		public function do_adsAdd(){	
			import('ORG.Net.UploadFile');
			$upload = new UploadFile();// 实例化上传类
			$upload->maxSize  = 3145728 ;// 设置附件上传大小
			$upload->savePath =  './UpFile/Ads/';// 设置附件上传目录
			if(!$upload->upload()) {
			// 上传错误提示错误信息
				$this->error_ajax($upload->getErrorMsg());
			}else{
			// 上传成功 获取上传文件信息
			$info =  $upload->getUploadFileInfo();
			}
			$ads = M('ads');
			$ads->create();
			$ads->photo=$info[0]['savename'];
			$sql="insert into ads(Name,Src,Url) values('{$this->_post('name')}','{$info[0]['savename']}','{$this->_post('url')}')";
			$rst=M()->execute($sql);
			$this->success_ajax("ok！");
		}
		//广告管理--删除
		public function adsDelete(){
			$sql="delete from ads where id={$this->_get('id')}";
			$rst=M()->execute($sql);
			if($rst){
				$this->success_ajax("ok");
			}else{
				$this->error_ajax("no");
			}
		}			
    }
